package com.cn.springcloudattachment.controller;

import com.cn.springcloudattachment.model.URole;
import com.cn.springcloudattachment.service.inter.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
public class TestAttlController {
    @Value("${server.port}")
    String port;

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Autowired
    private DemoService demoService;

    @RequestMapping("/hi")
    public String home(@RequestParam String name) {

        return "hi " + name + ",i am from port:" + port;
    }


    @RequestMapping("/test")
    public int demo(String name) {
        int result = demoService.add(name);
        return result;
    }
}
